//Thu May 19 05:37:47 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class BlackWhiteMagic {
public:
	int count(string creatures) {
		int ret = 0;
		for (int i = 0; i < creatures.size(); i++) {
			if (creatures[i] == 'B') {
				int found = creatures.find_last_of('W');
//				cout << found << endl;
				if (found >= 0 && found > i) {
					ret++;
					creatures[i] = 'W';
					creatures[found] = 'B';
				}
			}
		}
		return ret;
	}
};

